<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>模块列表</title>
		<%@ include file="../jslib/jquerylib.jsp" %>
		<script type="text/javascript" src="<%=request.getContextPath() %>/js_css_image/lhgdialog/lhgcore.lhgdialog.min.js?skin=mac"></script>
		<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/mypage.js"></script>
		<style>
		html,body {
			margin: 0;
			padding: 0;
			font-family: "Microsoft YaHei";
			font-size: 12.5px;;
		}
		html{
		    overflow-x: hidden;
			overflow-y: hidden;
		}
		.button_b{cursor:hand;}
		
		</style>
		<script type="text/javascript" >
		$(document).ready(function(){ 
						$("#gridTable").jqGrid({
							url:'queryAutoFormFieldListByFormId.action?formsId=<%=request.getParameter("formId")%>',
							datatype: "json",
							height: "440",
							width: "1020", 
							colNames:['编号','字段中文名','字段英文名','字段说明','字段类型','是否只读','验证类型','是否列表显示','是否页面显示','显示序列','表单显示宽度','是否排序','默认值'],
							colModel:[
								{name:'ID',index:'ID', width:60, key:true, sorttype:"int"},								
								{name:'cn_name',index:'cn_name', width:140},
								{name:'field_name',index:'field_name', width:110},
								{name:'field_note',index:'field_note', width:150},
								{name:'field_type',index:'field_type', width:90},
								{name:'is_read_only',index:'is_read_only', width:60},
								{name:'authentication_type',index:'authentication_type', width:60},
								{name:'is_list_show',index:'is_list_show', width:150,hidden:true,hidedlg:true},
								{name:'is_page_show',index:'is_page_show', width:80},
								{name:'show_seq',index:'show_seq', width:80},
								{name:'field_list_width',index:'field_list_width', width:80},
								{name:'is_order_by',index:'is_order_by', width:80},
								{name:'default_value',index:'default_value', width:80}
							], 
							shrinkToFit:false,
							sortname:'show_seq',
							sortorder:'asc',
							viewrecords:true,
							rownumbers: false,//显示行号
							rowNum:<%=session.getAttribute("SYS_PAGECOUNT")%>,
							rowList:[15,20,50,200,500],
							toolbar: [false,"top"],
							ondblClickRow : function(rowid){
					            var row = $("#gridTable").jqGrid('getRowData',rowid);
					            var fieldname= '<%=request.getParameter("fieldname")%>';
					            window.opener.document.getElementById(fieldname).value= row.field_name;
					            //window.returnValue = row.field_name;
					            window.close();
					        },
							jsonReader: {
								root:"rows",		// 数据行（默认为：rows）
								page: "page",  	// 当前页
								total: "total",  // 总页数
								records: "records",  // 总记录数
								repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
							},
							prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
							pager:"#gridPager",
							caption: "字段列表"
					});
					jQuery("#gridTable").jqGrid('navGrid','#gridPager',{add:false,edit:false,del:false,search:false,refresh:false});
					jQuery("#gridTable").jqGrid('navButtonAdd','#gridPager',
							{ 	
							caption: "列状态",                          
							title: "Reorder Columns",                           
							onClickButton : function (){                               
							jQuery("#gridTable").jqGrid('setColumns');                           
							}
					}); 
		});  
 
		//刷新页面
		function shuaXin(){
		  jQuery("#gridTable").jqGrid('setGridParam',
                   {
                       url:'queryAutoFormFieldListByFormId.action?formsId=<%=request.getParameter("formId")%>'
                   }).trigger("reloadGrid", [{page:1}]); 
        }
		</script>
		
	</head>

	<body style="margin-bottom: 0px">
		<table width="100%" style="height: 100%">
		<input type="hidden" value="<%=request.getParameter("formTableName")%>"/>
			<tr>
				<td width="100%">
					<table id="gridTable"></table>
					<div id="gridPager"></div>
				</td>
			</tr>
		</table>
	</body>
</html>